package com.example.win.android_banduyujia.peopleactivity.activity.activity.openactivity.DataActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.example.win.android_banduyujia.R;
import com.example.win.android_banduyujia.entity.CerBookEntity;
import com.example.win.android_banduyujia.lib.util.StrUtils;
import com.example.win.android_banduyujia.peopleactivity.activity.activity.openactivity.adapter.ListBookAdapter;
import com.example.win.android_banduyujia.peopleactivity.ui.activity.BaseTitleBarActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Win on 2015/10/15.
 */
public class CerNameActivity extends BaseTitleBarActivity {

    private ListView        mlistBook;
    private ListBookAdapter adapter;

    private ArrayList<CerBookEntity>  BookList;

    private View    header;
    private String  mName = " ";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_cer_name_page);

        InitTitles();
        InitViews();
    }

    private void InitTitles() {
        showLeftBackButton();
        setTitle(R.string.layout_project_certfition_name);
        setRightTextViewListener(R.string.layout_data_save_button, mSaveListener);
    }

    private View.OnClickListener mSaveListener = new View.OnClickListener(){

        @Override
        public void onClick(View v) {
            if(StrUtils.isEmpty(mName)){
                showToast(R.string.layout_project_certfition_name);
            }
            SaveName();
        }
    };

    private void SaveName() {

    }

    private void InitViews() {
        adapter = new ListBookAdapter(this, BookList);
       // mlistBook.setAdapter(adapter);
        adapter.notifyDataSetChanged();

        mlistBook = (ListView)findViewById(R.id.list_cer_name);
        mlistBook.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            }
        });
    }
}
